// pages/topic/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    toTag:'tag_1',
    labelId:-1,
    labels:[{
      id: -1,
      name: "全部"
    },{
      id: 0,
      name: "全部"
    },{
      id: 1,
      name: "全部"
    },{
      id: 2,
      name: "全部"
    },{
      id: 3,
      name: "全部"
    },{
      id: 4,
      name: "全部"
    },{
      id: 5,
      name: "全部"
    },{
      id: 6,
      name: "全部"
    },{
      id: 7,
      name: "全部"
    }]
  },
/**
   * 获取窗口高度
   */
  getScrollHeight() {
    const that = this;
    wx.getSystemInfo({
      success: function (res) {
        const windowHeight = res.windowHeight;
        const windowWidth = res.windowWidth;
        const ratio = 750 / windowWidth;
        const height = windowHeight * ratio;
        that.setData({
          height: height - 90
        })
      }
    })
  },
  /**
   * 标签切换
   */
  onTagTap(event) {
    const labelId = this.data.labelId
    const currLabelId = event.currentTarget.dataset.label

    // 如果显示下拉区则滚动Tag
    if (this.data.showPopup) {
      this.setData({
        toTag: "tag_" + currLabelId
      })
    }
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})